package com.cares.user.service.impl;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cares.user.dao.UserDao;
import com.cares.user.entity.UserVO;
import com.cares.user.service.UserService;

@Service("userService")
public class UserServiceImpl implements UserService {
	
	@Autowired
	private UserDao userDao;
	
	public String doQueryLoginedUser(String username, String password) {
		 String result = userDao.queryLoginedUser(username, password);
		 
		 if("1".equals(result)){
			 UserVO user = new UserVO();
				//user.setId(UUID.randomUUID().toString());
				user.setUserName(StringUtils.isBlank(username)?"test":username);
				user.setPassword(StringUtils.isBlank(password)?"test":password);
				user.setUserid(StringUtils.isBlank(username)?"test":username);
				userDao.createUser(user);
		 }
		 return result;
	}
	
}
